<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport"
		      content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">

		<!--引入本地 element-ui 的样式，-->
		<link rel="stylesheet" href="/admin/plugin/element-ui/index.css">
		<script type="text/javascript" src="/admin/js-css/js/vue.min.js"></script>
		<script type="text/javascript" src="/admin/plugin/element-ui/index.js"></script>

		<script type="text/javascript" src="/admin/js-css/js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="/admin/js-css/js/mx1.0.js?v=1.1.1"></script>

		<title>账户绑定</title>
	</head>
	<body>
		<div id="app">
			<h2>账户绑定</h2>
			<div class="contents">
				<label >表具号：</label>
				<input type="text" name="" placeholder="请输入表具号" v-model="bjh">
			</div>
			<div class="btns">
				<button class="btn" @click="savedata" >确认</button>
				<button class="btn" @click="chongzhi">重置</button>
			</div>
		</div>
	</body>
	<script>
		var vm = new Vue({
			el: '#app',
			data: {
				bjh:""
			},
			created(){
				localStorage.setItem("user", JSON.stringify({"org_id":"baicheng"}));
				this.loginOpenid();
			},
			methods: {
				//登录
				async loginOpenid(){
					this.parmsData = getParams();
					if(this.parmsData.code != "" && this.parmsData.code != undefined){
						const res = await postWebCustom(getTableId("1942"),{code:this.parmsData.code});
						if(res.code == 0){
							this.$message(res.msg);
							return;
						}
						if(res.data.openid){
							localStorage.setItem("token",res.data.openid);
						}
					}else {
						let token = localStorage.getItem("token");
						if(null == token){
							let url = wwwurl+"/admin/html/module/baicheng/userBinding.html";
							window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx5aba54c8ab15d29d&redirect_uri="+url+"&response_type=code&scope=snsapi_base&#wechat_redirect";
						}
					}

				},
				chongzhi(){
					this.bjh = "";
				},
				async savedata(){
					let i = loading();
					const res = await postWebCustom(getTableId("1944"),{bjh:this.bjh});
					i.close();
					this.$message(res.msg);
				},
			},
	
		})
	</script>
	<style type="text/css">
		body{
			margin: 0;
			padding: 10px;
		}
		
		#app{
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
		}
		
		.contents{
			width: 100%;
			display: grid;
			grid-template-columns: repeat(1, 80px 1fr);
		}
		.contents label{
			width: 80px;
			line-height: 45px;
			/* text-align: center; */
		}
		
		.contents input{
			width: 100%;
			height: 45px;
			padding: 10px;
			border-color: #ddd;
			border-radius: 8px;
			border-style: solid;
			outline: none;
			font-size: 16px;
		}
		
		.btns{
			display: flex;
			justify-content: center;
			margin-top: 40px;
		}
		
		.btn{
			background-color: #409eff;
			color: #fff;
			margin: 0 20px;
			padding: 10px 30px;
			border: none;
			border-radius: 4px;
		}
		
	</style>
</html>